import { ChartData } from './ChartData';
import { TimeMode } from '../constants/TimeMode';
import ChartLineData from './ChartLineData';
import Config from '../constants/Config';
import { getWeekDateRange } from '../utils/timer';
export class DataModel {
    requestData(v, w) {
        const x = new ChartData();
        switch (v) {
            case TimeMode.Day:
                const y = [];
                const z = [];
                for (let m1 = 0; m1 <= 24; m1++) {
                    y.push(Math.floor(this.generateRandomNumber(150, 200)));
                    z.push(m1 < 10 ? `0${m1}:00` : `${m1}:00`);
                }
                const a1 = [];
                for (let l1 = 0; l1 <= 24; l1++) {
                    a1.push(Math.floor(this.generateRandomNumber(120, 140)));
                }
                const b1 = [];
                for (let k1 = 0; k1 <= 24; k1++) {
                    b1.push(Math.floor(this.generateRandomNumber(80, 100)));
                }
                const c1 = [];
                c1.push(new ChartLineData("name1", "#F9365B", y));
                c1.push(new ChartLineData("name1", "#02C4B3", a1));
                x.setYAis(c1);
                x.setXAis(z);
                x.setTimeStep(6);
                break;
            case TimeMode.Week: {
                const d1 = [];
                const e1 = [];
                for (let i1 = 0; i1 < 7; i1++) {
                    d1.push(this.randomValue());
                    const j1 = Config.WEEK_DESC_ARRAY;
                    e1.push(j1[i1].toString());
                }
                const f1 = [];
                for (let h1 = 0; h1 < 7; h1++) {
                    f1.push(this.randomValue());
                }
                const g1 = [];
                g1.push(new ChartLineData("name1", "#02C4B3", d1));
                x.setYAis(g1);
                x.setXAis(getWeekDateRange(w));
                x.setTimeStep(1);
                break;
            }
        }
        return x;
    }
    randomValue() {
        const u = Math.random() * 10;
        if (u > 6) {
            return 0;
        }
        else {
            return Math.floor(this.generateRandomNumber(40, 200));
        }
    }
    generateRandomNumber(r, s) {
        const t = s - r + 1;
        return Math.floor(Math.random() * t) + r;
    }
}
